/ Assembly List / LJCNetCommon / NetCommon / XmlDeserializeMessage

Namespace - LJCNetCommon


Parameters
type - The object type.
message - The message string.

Returns

The deserialized object.

Syntax

C#
public static Object XmlDeserializeMessage(Type type, String message)

Deserialize an XML message string to an object. (E)

Example

C#
using LJCNetCommon;
      
public class Person
{
  public long Id { get; set; }
  public string Name { get; set; }
  public bool PrincipleFlag { get; set; }
}
        
// Deserialize an XML message string to an object.
private static void XmlDeserializeMessage()
{
  // Setup
  var person = new Person()
  {
    Id = 2,
    Name = "Text",
    PrincipleFlag = true
  };
  string message = NetCommon.XmlSerializeToString(person.GetType(), person, null);

  // Deserialize an XML message string to an object.
  Person newPerson;
  newPerson = NetCommon.XmlDeserializeMessage(typeof(Person), message) as Person;
}

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.